package com.best.oasis.settlement.common.vo.sysLog;

import java.util.Date;

import org.springframework.security.Authentication;
import org.springframework.security.context.SecurityContextHolder;

import com.best.oasis.settlement.common.vo.base.BaseVO;


/**
 * 系统关键操作日志
 * @author BL00064
 *
 */
public class SysLogVO extends BaseVO {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;
    
    private Long id;
    /**
     * 操作时间
     */
    private Date operationTime;
    /**
     * 操作人username
     */
    private String operator;
    /**
     * 操作人权限列表
     */
    private String userPrivileges;
    /**
     * 操作人ip
     */
    private String operatorIP;
    /**
     * 操作描述
     */
    private String description;
    /**
     * 操作类型
     */
    private String type;
    
    public SysLogVO() {
    }
    
    public SysLogVO(String type, String description) {
        this.operationTime = new Date();
        //this.operator = SecurityUtil.getLoginUsername();
        if(this.operator == null){
            this.operator = "_system_";
        }
        Authentication auth = SecurityContextHolder.getContext().getAuthentication();
        if(auth != null){
            this.userPrivileges = auth.getAuthorities().toString();
        }
       //this.operatorIP = RequestUtil.getUserIp();
        
        this.description = description;
        this.type = type;
    }
    
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Date getOperationTime() {
        return operationTime;
    }
    public void setOperationTime(Date operationTime) {
        this.operationTime = operationTime;
    }
    public String getOperator() {
        return operator;
    }
    public void setOperator(String operator) {
        this.operator = operator;
    }
    public String getUserPrivileges() {
        return userPrivileges;
    }
    public void setUserPrivileges(String userPrivileges) {
        this.userPrivileges = userPrivileges;
    }
    public String getOperatorIP() {
        return operatorIP;
    }
    public void setOperatorIP(String operatorIP) {
        this.operatorIP = operatorIP;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
}
